package com.indicator.client.bean;

import java.math.BigDecimal;

public class DefaultIndicatorCalculator extends CalculatorBase implements IndicatorCalculator {

    private BigDecimal value1;
    private String type = "-1";


    @Override
    public void calculate(Indicator indicator, BigDecimal value2) {
        if (type.equals("-1")) {
            value1 = value2;

        } else {
            value1 = super.calculate(value1, value2, this.type);
        }
        this.type = indicator.getType();
    }

    public BigDecimal getValue() {
        return value1;
    }
}
